from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save

## FIXME: - guardar la suscripcion elegida en UserProfile
#           revisar modelo UML

class UserProfile(models.Model):
    user = models.OneToOneField(User)
    subscription = models.ForeignKey("Subscription")

    def create_user_profile(sender, instance, created, **kwargs):
    # Create user profile after create user
        if created:
            UserProfile.objects.create(user=instance)
post_save.connect(UsersProfile.create_user_profile, sender=User)

class Subscription(models.Model):
    newsletter = models.BooleanField()